{template '_header'}
<div class="page-heading"> 
    <span class='pull-right'>
       	<a class='btn btn-default btn-sm' href="{php echo referer()}">返回</a>
    </span>
    <h2>评论管理</h2> </div>

{if !empty($board) && !empty($post)}
<div class="panel panel-default">
    <div class="panel-heading">
        <span class="pull-right aops">

              <a class='{if $post['deleted']==1}text-default{else}text-danger{/if}'
                {ifp 'sns.posts.delete'}
                data-toggle='ajaxSwitch'
                data-switch-value='{$post['deleted']}'
                data-switch-value0='0|正常|text-danger|{php echo webUrl('sns/posts/delete',array('deleted'=>1,'id'=>$post['id']))}'
                data-switch-value1='1|已删除|text-default|{php echo webUrl('sns/posts/delete',array('deleted'=>0,'id'=>$post['id']))}'
                {/if}>
                {if $post['deleted']==1}已删除{else}正常{/if}
            </a>

            <a class='{if $post['checked']==1}text-danger{else}text-default{/if}'
                {ifp 'sns.posts.edit'}
                data-toggle='ajaxSwitch'
                data-switch-value='{$post['checked']}'
                data-switch-value0='0|待审核|text-default|{php echo webUrl('sns/posts/check',array('checked'=>1,'id'=>$post['id']))}'
                data-switch-value1='1|已审核|text-danger|{php echo webUrl('sns/posts/check',array('checked'=>0,'id'=>$post['id']))}'
                {/if}>
                {if $post['checked']==1}已审核{else}待审核{/if}
            </a>

            <a class='{if $post['isboardbest']==1}text-danger{else}text-default{/if}'
                {ifp 'sns.posts.edit'}
                data-toggle='ajaxSwitch'
                data-switch-value='{$post['isboardbest']}'
                data-switch-value0='0|版块精华|text-default|{php echo webUrl('sns/posts/best',array('best'=>1,'all'=>0, 'id'=>$post['id']))}'
                data-switch-value1='1|版块精华|text-danger|{php echo webUrl('sns/posts/best',array('best'=>0,'all'=>0,'id'=>$post['id']))}'
                {/if}>
               版块精华
            </a>

            <a class='{if $post['isbest']==1}text-danger{else}text-default{/if}'
                {ifp 'sns.posts.edit'}
                data-toggle='ajaxSwitch'
                data-switch-value='{$post['isbest']}'
                data-switch-value0='0|全站精华|text-default|{php echo webUrl('sns/posts/best',array('best'=>1,'all'=>1,'id'=>$post['id']))}'
                data-switch-value1='1|全站精华|text-danger|{php echo webUrl('sns/posts/best',array('best'=>0,'all'=>1,'id'=>$post['id']))}'
                {/if}>
                全站精华
            </a>


            <a class='{if $post['isboardbest']==1}text-danger{else}text-default{/if}'
                {ifp 'sns.posts.edit'}
                data-toggle='ajaxSwitch'
                data-switch-value='{$post['isboardbest']}'
                data-switch-value0='0|版块置顶|text-default|{php echo webUrl('sns/posts/best',array('top'=>1,'all'=>0, 'id'=>$post['id']))}'
                data-switch-value1='1|版块置顶|text-danger|{php echo webUrl('sns/posts/best',array('top'=>0,'all'=>0,'id'=>$post['id']))}'
                {/if}>
                版块置顶
            </a>

            <a class='{if $post['istop']==1}text-danger{else}text-default{/if}'
                {ifp 'sns.posts.edit'}
                data-toggle='ajaxSwitch'
                data-switch-value='{$post['istop']}'
                data-switch-value0='0|全站置顶|text-default|{php echo webUrl('sns/posts/top',array('top'=>1,'all'=>1,'id'=>$post['id']))}'
                data-switch-value1='1|全站置顶|text-danger|{php echo webUrl('sns/posts/top',array('top'=>0,'all'=>1,'id'=>$post['id']))}'
                {/if}>
                全站置顶
            </a>
            
        </span>
        版块: {$board['title']}
    </div>
    <div class="panel-body">

        <div class="row">
        <div class="col-sm-2" style="line-height:22px;">
            {ifp 'member.list.view'}<a href="{php echo webUrl('member/list/detail',array('id' => $member['id']));}" title='会员信息' target='_blank'>
             <img src="{$post['avatar']}" style="border:1px solid #ccc;width:80px;height:80px; padding:1px" /><br />
             <span>{$post['nickname']}</span>
        </a>

            {else}
            <img src="{$post['avatar']}" style="border:1px solid #ccc;width:80px;height:80px; padding:1px" /><br />
            <span>{$post['nickname']}</span>

            {/if}

            <br/>
            <span class="label label-default" style="background:{$level['bg']};color:{$level['color']}">{$level['levelname']}</span>
            {if $isManager}
            <br/><span class="label label-warning">版主</span>
            {/if}
            <br/>积分: {$member['sns_credit']}
            <br/>话题: {$member['postcount']}
            <br/>评论: {$member['replycount']}


        </div>

            <div class="col-sm-10">
                <h3>{$post['title']} <h4 style="padding:0;line-height: 5px;font-weight: normal;"><br/>发布时间: {php echo date('Y-m-d H:i:s',$post['createtime'])}</h4></h3><br/>
                {$post['content']}
                {if count($post['images'])>0}
                <br/>
{loop $post['images'] $img}
                <a href="{php echo tomedia($img)}" target="_blank"><img src="{php echo tomedia($img)}" style="width:100px;border:1px solid #ccc;padding:1px;margin:2px;" /></a>
                {/loop}
                {/if}

            </div>

        </div>
    </div>

</div>
{/if}

<form action="./index.php" method="get" class="form-horizontal form-search" role="form">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r"  value="sns.replys" />
    <input type="hidden" name="id"  value="{$pid}" />
    <div class="page-toolbar row m-b-sm m-t-sm">
        <div class="col-sm-4">
            <div class="input-group-btn">
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                {ifp 'sns.board.delete'}
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch' data-href="{php echo webUrl('sns/posts/delete',array('deleted'=>1))}"><i class='fa fa-circle'></i> 恢复</button>
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch'  data-href="{php echo webUrl('sns/posts/delete',array('deleted'=>0))}"><i class='fa fa-circle-o'></i> 删除</button>
                {/if}

                {ifp 'sns.board.edit'}
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch' data-href="{php echo webUrl('sns/posts/check',array('checked'=>1))}"><i class='fa fa-circle'></i> 审核通过</button>
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch'  data-href="{php echo webUrl('sns/posts/check',array('checked'=>0))}"><i class='fa fa-circle-o'></i> 取消审核</button>
                {/if}
            </div>
        </div>


        <div class="col-sm-6 pull-right">
            <select name="checked" class='form-control input-sm select-sm'>
                <option value="" {if $_GPC['checked'] == ''} selected{/if}>审核</option>
                <option value="1" {if $_GPC['checked'] == '1'} selected{/if}>通过</option>
                <option value="0" {if $_GPC['checked']== '0'} selected{/if}>不通过</option>
            </select>
            <select name="deleted" class='form-control input-sm select-sm'>
                <option value="" {if $_GPC['deleted'] == ''} selected{/if}>状态</option>
                <option value="0" {if $_GPC['deleted'] == '0'} selected{/if}>正常</option>
                <option value="1" {if $_GPC['deleted']== '1'} selected{/if}>删除</option>
            </select>
            <div class="input-group">
                <input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="会员信息/话题标题"> <span class="input-group-btn">
                    		
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button> </span>
            </div>
        </div>

    </div>
</form>

<form action="" method="post">
    {if count($list)>0}
    <table class="table table-responsive table-hover" >
        <thead class="navbar-inner">
        <tr>
            <th style="width:25px;"><input type='checkbox' /></th>

            <th style='width:100px;'></th>
            <th style='width: 320px;'>内容</th>
            <th style='width: 90px;'>回复时间</th>
            <th style="width:60px">状态</th>
             <th style="width: 145px;">操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $row}
        <tr>
            <td style="overflow-x: hidden; vertical-align: top">
                <input type='checkbox'   value="{$row['id']}"/>
            </td>

            <td style="overflow-x: hidden; vertical-align: top">
                {ifp 'member.list.view'}
                <a href="{php echo webUrl('member/list/detail',array('id' => $row['member']['id']));}" title='会员信息' target='_blank'>
                    <img src="{$row['avatar']}" style="border:1px solid #ccc;width:60px;height:60px; padding:1px" /><br />
                    <span>{$row['nickname']}</span>
                </a>

                {else}
                <img src="{$row['avatar']}" style="border:1px solid #ccc;width:60px;height:60px; padding:1px" /><br />
                <span>{$row['nickname']}</span>

                {/if}

                <br/>
                <span class="label label-default" style="background:{$row['level']['bg']};color:{$row['level']['color']}">{$row['level']['levelname']}</span>
                {if $row['isAuthor']}
                <br/><span class="label label-primary">楼主</span>
                {/if}
                {if $row['isManager']}
                <br/><span class="label label-warning">版主</span>
                {/if}
                <br/>积分: {$row['member']['sns_credit']}
                <br/>话题: {$row['member']['postcount']}
                <br/>评论: {$row['member']['replycount']}


            </td>

            <td class='full' style="overflow-x: hidden; vertical-align: top">
                {if !empty($row['parent'])}
                回复:{$row['parent']['nickname']}<br/>
                {/if}
                {$row['content']}
                {if count($row['images'])>0}
                <br/>
                {loop $row['images'] $img}
                <a href="{php echo tomedia($img)}" target="_blank"><img src="{php echo tomedia($img)}" style="width:50px;border:1px solid #ccc;padding:1px;margin:2px;" /></a>
                {/loop}
                {/if}
            </td>
            <td  style="overflow-x: hidden; vertical-align: top">
                {php echo date('Y-m-d', $row['createtime'])}<br/>
                {php echo date('H:i', $row['createtime'])}
            </td>
<td  style="overflow-x: hidden; vertical-align: top">

    <span class='label {if $row['deleted']==1}label-default{else}label-success{/if}'
    {ifp 'sns.posts.delete'}
    data-toggle='ajaxSwitch'
    data-switch-value='{$row['deleted']}'
    data-switch-value0='0|正常|label  label-success|{php echo webUrl('sns/posts/delete',array('deleted'=>1,'id'=>$row['id']))}'
    data-switch-value1='1|已删除|label label-default|{php echo webUrl('sns/posts/delete',array('deleted'=>0,'id'=>$row['id']))}'
    {/if}>
    {if $row['deleted']==1}已删除{else}正常{/if}
    </span>
<br/>
    <span class='label {if $row['checked']==1}label-success{else}label-default{/if}'
    {ifp 'sns.posts.edit'}
    data-toggle='ajaxSwitch'
    data-switch-value='{$row['checked']}'
    data-switch-value0='0|待审核|label label-default|{php echo webUrl('sns/posts/check',array('checked'=>1,'id'=>$row['id']))}'
    data-switch-value1='1|已审核|label label-success|{php echo webUrl('sns/posts/check',array('checked'=>0,'id'=>$row['id']))}'
    {/if}>
    {if $row['checked']==1}已审核{else}待审核{/if}
    </span>
</td>
            <td style="text-align:left;vertical-align: top"">
                {ifp 'sns.posts.delete'}
                <a data-toggle='ajaxRemove' href="{php echo webUrl('sns/posts/delete1', array('id' => $row['id']))}"class="btn btn-default btn-sm" data-confirm='确认要彻底删除此帖子吗?'><i class="fa fa-trash"></i> 彻底删除</a>
                {/if}
            </td>
        </tr>
        {if !empty($row['subject'])}
        <tr>
            <td>&nbsp;</td>
            <td colspan="5">
                <div class="panel panel-info" >
                    <div class="panel-body">
                        <div class="row">
                          <a href="{php echo webUrl('sns/replys',array('id'=>$row['pid']))}" target="_blank">
                        <div class="col-sm-1"><img src="{php echo tomedia($row['subject']['thumb'])}" style="width:50px;border:1px solid #ccc;padding:1px;margin:2px;" /></div>
                        <div class="col-sm-11"><h4 style="padding:0;line-height: 0px;">{$row['subject']['title']}</h4>
                            <br/>
                            版块: {$row['subject']['boardtitle']}
                        </div>
                          </a>
                        </div>
                    </div>
                </div>

            </td>

        </tr>
        {/if}
        {/loop}

        </tbody>
    </table>
    {$pager}
    {else}
    <div class='panel panel-default'>
        <div class='panel-body' style='text-align: center;padding:30px;'>
            暂时没有任何版块!
        </div>
    </div>
    {/if}

</form>


{template '_footer'}